var teamId;
var tmGameId;
var startDate;
var endDate;
var tmScoreListId;
var backURL;
var tmScoreList={};//榜单对象
var defaultTab="techScoreLi";
$(document).ready(function(){
	$.ajaxSettings.async = false;
	$('#header').animate({'top':'0px'},400);
	teamId = args.teamId; //取得id的值
	tmGameId = args.tmGameId;
	startDate = args.startDate;
	endDate = args.endDate;
	tmScoreListId = args.tmScoreListId;
	backURL = args.backURL;
	defaultTab=args.defaultTab;
	if(tmGameId==undefined||tmGameId=="undefined"){
		tmGameId="";
	}
	if(startDate==undefined||startDate=="undefined"){
		startDate="";
	}
	if(endDate==undefined||endDate=="undefined"){
		endDate="";
	}
	if(tmScoreListId!=undefined&&tmScoreListId!="undefined"&&tmScoreListId!=""){
		$.getJSON(path+"/soccer/tmScoreListAction!selectById.action",{tmScoreListId: tmScoreListId}, function(data){
			tmScoreList=data.tmScoreList;
		});
	}else{
		tmScoreListId="";
	}
	var tabHtml=[];
	if(defaultTab==undefined||defaultTab=="undefined"||defaultTab=="techScoreLi"){
		tabHtml.push("<li class='active' id='techScoreLi' onclick='viewTechScore()' style='width:60px;margin:0px;'><a href='#techScoreTab' data-toggle='tab'>评分榜</a></li>");
	}else{
		tabHtml.push("<li id='techScoreLi' onclick='viewTechScore()' style='width:60px;margin:0px;'><a href='#techScoreTab' data-toggle='tab'>评分榜</a></li>");
	}
	if(defaultTab=="scoreLi"){
		tabHtml.push("<li class='active' id='scoreLi' onclick='viewScore()' style='width:60px;margin:0px;'><a href='#scoreTab' data-toggle='tab'>进球榜</a></li>");
	}else{
		tabHtml.push("<li id='scoreLi' onclick='viewScore()' style='width:60px;margin:0px;'><a href='#scoreTab' data-toggle='tab'>进球榜</a></li>");
	}
	if(defaultTab=="assistLi"){
		tabHtml.push("<li class='active' id='assistLi' onclick='viewAssist()' style='width:60px;margin:0px;'><a href='#assistTab' data-toggle='tab'>助攻榜</a></li>");
	}else{
		tabHtml.push("<li id='assistLi' onclick='viewAssist()' style='width:60px;margin:0px;'><a href='#assistTab' data-toggle='tab'>助攻榜</a></li>");
	}
	if("Y"==tmScoreList.disciplineFlag||tmScoreList.disciplineFlag==undefined){
		if(defaultTab=="disciplineLi"){
			tabHtml.push("<li class='active' id='disciplineLi' onclick='viewDiscipline()' style='width:60px;margin:0px;'><a href='disciplineTab' data-toggle='tab'>违规榜</a></li>");
		}else{
			tabHtml.push("<li id='disciplineLi' onclick='viewDiscipline()' style='width:60px;margin:0px;'><a href='disciplineTab' data-toggle='tab'>违规榜</a></li>");
		}
	}
	
	$("#dataTab").html(tabHtml.join(""));  
});
function goBack(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+sessionStorage.getItem("teamGameDataSet-backURL")+"?teamId="+teamId+"&tmGameId="+tmGameId
	+"&startDate="+startDate+"&endDate="+endDate+"&timestamp="+timestamp;
}
function viewTechScore(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamGameDataSet-techScore.jsp?teamId="+teamId+"&tmGameId="+tmGameId+"&tmScoreListId="+tmScoreListId
	+"&startDate="+startDate+"&endDate="+endDate+"&backURL="+backURL+"&defaultTab=techScoreLi"+"&timestamp="+timestamp;
}
function viewScore(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamGameDataSet-score.jsp?teamId="+teamId+"&tmGameId="+tmGameId+"&tmScoreListId="+tmScoreListId
	+"&startDate="+startDate+"&endDate="+endDate+"&backURL="+backURL+"&defaultTab=scoreLi"+"&timestamp="+timestamp;
}
function viewAssist(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamGameDataSet-assist.jsp?teamId="+teamId+"&tmGameId="+tmGameId+"&tmScoreListId="+tmScoreListId
	+"&startDate="+startDate+"&endDate="+endDate+"&backURL="+backURL+"&defaultTab=assistLi"+"&timestamp="+timestamp;
}
function viewDiscipline(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamGameDataSet-discipline.jsp?teamId="+teamId+"&tmGameId="+tmGameId+"&tmScoreListId="+tmScoreListId
	+"&startDate="+startDate+"&endDate="+endDate+"&backURL="+backURL+"&defaultTab=disciplineLi"+"&timestamp="+timestamp;
}
